import request from '@/utils/request'

export function createPerson(data) {
  return request({
    url: 'http://dgzhet.com:8000/api/users/',
    method: 'post',
    data
  })
}

export function getPersonList(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/users/',
    method: 'get',
    params
  })
}

export function getInformationsList(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/informations/',
    method: 'get',
    params
  })
}

export function deleteInformation(id) {
  return request({
    url: 'http://dgzhet.com:8000/api/informations/' + id + '/',
    method: 'delete',
  })
}

export function updateInformation(id, data) {
  return request({
    url: 'http://dgzhet.com:8000/api/informations/' + id + '/',
    method: 'patch',
    data
  })
}

export function createInformation(data) {
  return request({
    url: 'http://dgzhet.com:8000/api/informations/',
    method: 'post',
    data
  })
}

export function createTask(data) {
  return request({
    url: 'http://dgzhet.com:8000/api/tasks/',
    method: 'post',
    data
  })
}

export function getTaskList(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/tasks/',
    method: 'get',
    params
  })
}

export function getTaskList2(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/tasks2/',
    method: 'get',
    params
  })
}

export function updateTask(id, data) {
  return request({
    url: 'http://dgzhet.com:8000/api/tasks/' + id + '/',
    method: 'patch',
    data
  })
}


export function createShortage(data) {
  return request({
    url: 'http://dgzhet.com:8000/api/shortages/',
    method: 'post',
    data
  })
}

export function getShortageList(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/shortages/',
    method: 'get',
    params
  })
}

export function createMachine(data) {
  return request({
    url: 'http://dgzhet.com:8000/api/machines/',
    method: 'post',
    data
  })
}

export function getMachineList(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/machines/',
    method: 'get',
    params
  })
}


export function updateMachine(id, data) {
  return request({
    url: 'http://dgzhet.com:8000/api/machines/' + id + '/',
    method: 'patch',
    data,
  })
}

export function updateShortage(id, data) {
  return request({
    url: 'http://dgzhet.com:8000/api/shortages/' + id + '/',
    method: 'patch',
    data
  })
}

export function getall(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/get/all/',
    method: 'get',
    params
  })
}


export function updatePerson(id, data) {
  return request({
    url: 'http://dgzhet.com:8000/api/users/' + id + '/',
    method: 'patch',
    data
  })
}

export function getDeleteInformation(params) {
  return request({
    url: 'http://dgzhet.com:8000/api/deleteinformations/',
    method: 'get',
    params
  })
}
